from urllib.request import urlopen
from bs4 import BeautifulSoup
import re

# if has Chinese, apply decode()
html = urlopen(
    "https://morvanzhou.github.io/static/scraping/table.html"
    ).read().decode('utf-8')
#print(html)
#soup = BeautifulSoup(html, features='html.parser')

soup = BeautifulSoup(html, features='lxml')

# print(soup.h1)
# print('\n', soup.p)

# all_href = soup.find_all('a')
# all_href = [l['href'] for l in all_href]
# print('\n', all_href)
# for l in all_href:
#     print( l['href'] )

# month = soup.find_all('li', {"class": "month"})
# for m in month:
#     print(m.get_text())
# jan = soup.find('ul', {"class": "jan"})
# d_jan=jan.find_all('li')
# for d in d_jan:
#     print(d.get_text())
# print(d_jan)

img_links = soup.find_all("img", {"src": re.compile('https://.*?')})
for link in img_links:
    print(link['src'])
# course_links = soup.find_all('a', {'href': re.compile('https://.*?')})
# for link in course_links:
#     print(link['href'])
